/*
 * Marketing Report.java
 *
 * Created on June 20, 2002, 4:23 PM
 */

package com.scalar.chiptrack.marketing.actions;

import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.scalar.chiptrack.ChipTrackAction;
import com.scalar.chiptrack.operations.process.dao.FinishedGoodsDAO;
import com.scalar.chiptrack.sales.Customer;
import com.scalar.chiptrack.sales.dao.CustomerDAO;

/**
 *
 * @author  Raj Vallamsetla
 * @version 1.0
 */
public class MarketingReportAction extends ChipTrackAction {
    
       public ActionForward execute (ActionMapping mapping,
                                      ActionForm form,
                                      HttpServletRequest request,
                                      HttpServletResponse response) 
                                      throws Exception {

			String action = request.getParameter("action");
                                 
            try{

			ArrayList mktgPartNumberList = null;
			
			mktgPartNumberList = FinishedGoodsDAO.loadAllFinishedGoods();
			request.setAttribute("mktgPartNumberSelectList",mktgPartNumberList);

			ArrayList customerList = CustomerDAO.getAllCustomers();
			ArrayList customerSelectList = new ArrayList();
			Customer customer = new Customer();

			for(int i=0;i<customerList.size();i++){
			customer = (Customer)customerList.get(i);
			customerSelectList.add(customer);
			}
			
			request.setAttribute("customerSelectList",customerSelectList);


			//System.out.println("action "+action);
                        
                
            }catch(Exception e){
                e.printStackTrace();
            }

			if(action.equals("pricereport")){
             return (mapping.findForward("pricereport"));
			}
			
			if(action.equals("forecastreport")){
			 return (mapping.findForward("forecastreport"));	
			}

		 	return null;

       }
}
